package fr.umlv.galcon.player.ai;

import java.util.TimerTask;

import fr.umlv.galcon.game.GalconManager;
import fr.umlv.galcon.player.Player;

/**
 * Allow a computer player to play alone.
 * 
 */
public class ArtificialIntelligence extends TimerTask {
    private final AIStrategy attackStrategy;

    /**
     * Constructor
     * 
     * @param time
     *            The time between two decisions.
     * @param player
     *            The player concerned.
     */
    public ArtificialIntelligence(int time, Player player) {
	this.attackStrategy = new AIAttack(player);
    }

    @Override
    public void run() {
	if (GalconManager.getEndGame() || GalconManager.isOver())
	    cancel();

	this.attackStrategy.action();

    }
}
